﻿<%@ Page Language="C#" MasterPageFile="~/Masters/AdminSchedule.master" AutoEventWireup="true"
		 CodeFile="TripRule.aspx.cs" Inherits="Pages_Carrier_TripRule" Title="Расписание" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" Runat="Server">
	<link rel="stylesheet" type="text/css" media="screen" href="../../styles/EntityViewStyle.css" />
	<link rel="stylesheet" type="text/css" media="screen" href="../../styles/EntityEditStyle.css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphContent" Runat="Server">
	<a href='<%= ResolveUrl("~/Pages/Carrier/TripRuleEdit.aspx") %>'>Добавить новый</a>
	<asp:Repeater runat="server" ID="rptTripRules">
		<HeaderTemplate>
			<table class="miniTableView">
				<tr>
					<th>Маршрут</th>
					<th>Автобус</th>
					<th>Время</th>
					<th>Дата начала</th>
					<th>Дата конца</th>
					<th>Дни следования</th>
					<th>Генерация рейсов</th>
				</tr>
		</HeaderTemplate>
		<ItemTemplate>
				<tr>
					<td style="text-align: center;">
						<a href='<%# string.Format("{0}?Id={1}", ResolveUrl("~/Pages/Carrier/TripRuleEdit.aspx"), Eval("TripRule_id")) %>'>
							<%# Eval("Route_name")%>
						</a>
					</td>
					<td style="text-align: center;"><%# Eval("Bus_name") %></td>
					<td style="text-align: center;"><%# DS.ToShortStringTime(Eval("TripRule_Time")) %></td>
					<td style="text-align: center;"><%# DS.ToShortStringDateTime(Eval("TripRule_StartDT")) %></td>
					<td style="text-align: center;"><%# DS.ToShortStringDateTime(Eval("TripRule_EndDT")) %></td>
					<td style="text-align: center;"><%# Eval("TripRule_Days") %></td>
					<td style="text-align: center;">
						<asp:LinkButton runat="server" CommandArgument='<%# Eval("TripRule_id") %>' Text="Сгенерировать" OnClick="OnViewGenerateWindow" />
					</td>
				</tr>
		</ItemTemplate>
		<FooterTemplate>
			</table>
		</FooterTemplate>
	</asp:Repeater>
	
	<div id="modal" runat="server" class="modaldiv" style="display:none;">
		<asp:UpdatePanel runat="server" ID="upGenerate">
			<ContentTemplate>
				C <asp:TextBox runat="server" ID="tbDateFrom" Width="100" />
				<asp:RequiredFieldValidator runat="server" ID="rfvDateFrom" Text="*" ValidationGroup="vgGenerate" ControlToValidate="tbDateFrom" />
				<asp:RangeValidator runat="server" ID="rvDateFrom" Text="*" ValidationGroup="vgGenerate" ControlToValidate="tbDateFrom"
									Type="Date" MinimumValue="01.01.2010" MaximumValue="01.01.2100" />
				по <asp:TextBox runat="server" ID="tbDateTo" Width="100" />
				<asp:RequiredFieldValidator runat="server" ID="rfvDateTo" Text="*" ValidationGroup="vgGenerate" ControlToValidate="tbDateTo" />
				<asp:RangeValidator runat="server" ID="rvDateTo" Text="*" ValidationGroup="vgGenerate" ControlToValidate="tbDateTo"
									Type="Date" MinimumValue="01.01.2010" MaximumValue="01.01.2100" />
				<asp:CompareValidator runat="server" ID="cvDateFromTo" Text="*" ValidationGroup="vgGenerate" ControlToCompare="tbDateFrom"
										ControlToValidate="tbDateTo" Operator="GreaterThanEqual" />
				<asp:HiddenField runat="server" ID="hfModalAction" />
			</ContentTemplate>
		</asp:UpdatePanel>
		<div style="text-align: right;">
			<asp:Button runat="server" ID="btnGenerate" Text="Сгенерировать" ValidationGroup="vgGenerate" OnClick="OnGenerate" />
			<asp:Button runat="server" ID="btnModalClose" Text="Закрыть" />
		</div>
	</div>
	<asp:LinkButton Text="" runat="server" ID="lnkPopup" />
	<ajax:ModalPopupExtender ID="MPE" runat="server" PopupControlID="modal" TargetControlID="lnkPopup"
		CancelControlID="btnModalClose" BehaviorID="MPEbeh" BackgroundCssClass="ui-modal-overlay"
		OkControlID="btnModalClose" />
</asp:Content>

